package qz_rpt
import com.tsqc.system.util.table.TranposUtils

class LineIdWipController {

    def commonDataService
    def dynamicQueryService
    def index(Integer max) {
        def cellList = org.kdx.DataUtils.getCellList()
        def pageSizeList = org.kdx.DataUtils.getPageSizeList()

        [totalCount: 5, pageSize: 20, pageCurrent: 1, orderField: 'id', orderDirection: 'asc', pageSizeList: pageSizeList, cellList: cellList]
    }
    def lineIdWip(){
        def pageCurrent = params.pageCurrent ? Integer.parseInt(params.pageCurrent) : 1
        def pageSize = params.pageSize ? Integer.parseInt(params.pageSize) : 10
        params.startno = (pageSize * (pageCurrent - 1)) + 1
        params.endno = pageSize * pageCurrent
        def pageSizeList = [10,20,50,100]
        println(params.partDesc)
        params.SYS_QUERY_NAME = 'lineIdWip'
        def lineIdWip = dynamicQueryService.queryForList(params)
        def list=TranposUtils.colToRow('STEP_NAME','MAIN_QTY',lineIdWip)
        println(list)


        def tableHeadList =  []
        if(list.size()>0){
            tableHeadList =  list[0].keySet()
        }
        params.SYS_QUERY_NAME = 'lineIdWipCount'
        def totalCount = dynamicQueryService.queryForList(params)[0].TOTALCOUNT
        params.SYS_QUERY_NAME = 'lineIdWipLine'
        def lineIdWipLine = dynamicQueryService.queryForList(params)


        [totalCount:totalCount,
         pageSizeList:pageSizeList,pageSize:pageSize,
         startno:params.startno?:'',endno:params.endno?:'',
         lineIdWip:lineIdWip,lineId:params.lineId?:'',lotId:params.lotId?:'',lineIdWipLine:lineIdWipLine,
         startTime:params.startTime?:'',endTime:params.endTime?:'',
         list:list,tableHeadList:tableHeadList]
    }
}
